﻿
@{
    Layout = "_Square";
}
@model PagingDataSet<ActivesMember>
@section Aside{}
@section Banner{}
<script src="@Tunynet.Utilities.WebUtility.ResolveUrl("~/Applications/Microblog/Scripts/tunynet/jquery.spb.microblog.List.js")" type="text/javascript"></script>
<link href="/Themes/Shared/DefaultStyle/css/list.css" rel="stylesheet" type="text/css" />
<div class="twb"></div>
 <div class="wrapper">
        <!--列表开始-->
        <div class="p-list clearfix">

            <!--列表头部开始-->
            <div class="p-top clearfix">
                <!--排序开始-->
                <div class="p-px">
                    <dl>
                        <span>活动筛选：</span>
                        <a class="cur" href="#">默认排序</a>
                        <span>&nbsp;&nbsp;</span>
                    </dl>
                </div>
                <!--排序结束-->

            </div>
            <!--列表头部结束-->
            <!--活动列表开始-->

            <div class="fl_left">
                @{
                    if (Model.Count() > 0)
                    {
                        foreach (var temp in Model)
                        { 
                           <div class="gfhd">
                    <div class="title"><strong>@temp.Subject</strong></div>
                    <div class="hdlogo"><img width="200px" height="100px" src="/Uploads/@temp.FeaturedImage" /></div>
                    @*<div class="sm">@Html.Raw(temp.Body)</div>*@
                    <div class="list" style="font-size:12px; line-height:22px;">
                            <p><strong>主办单位： </strong>@temp.HostUnit</p>
                        <p>
                            <strong>
                                参加人数：
                            </strong>
                                @{
                            if (!string.IsNullOrEmpty(temp.member))
                            {
                                UserService service = new UserService();
                                var arr = temp.member.Split(',');
                                int mal = 0;//男
                                int fmal = 0;//女
                                for (var i = 0; i < arr.Length; i++)
                                {
                                    long result = 0;
                                    long.TryParse(arr[i], out result);
                                    var user = service.GetFullUser(result);
                                    if (user == null)
                                    {
                                        continue;
                                    }

                                    if (user.Profile.Gender == GenderType.Male)
                                    {
                                        mal += 1;
                                    }
                                    if (user.Profile.Gender == GenderType.FeMale)
                                    {
                                        fmal += 1;
                                    }

                                }

                                @:男生<b>@(mal)</b>人
                                    @:女生<b>@(fmal)</b>人
                                    @:总共<b>@(arr.Count())</b>人

                            }
                            else
                            {
                                @:暂无人参加活动
                            }
                                }
</p>
                            
                            <p><strong>开始时间： </strong>@temp.ReleaseDate</p>
                            <p><strong>聚会地点： </strong>@temp.MeetingAddress</p>
                            <p><strong>邀请人数： </strong>@temp.NumberInvite</p>
                            <p><strong>联系电话： </strong>@temp.MeetingTel</p>
                       
                    </div>
                               <div class="button_02">
                                   @if(string.IsNullOrEmpty(temp.member)||!temp.member.Contains(temp.UserId.ToString()))
                               {
                                       <a href="javascript:;" onclick="join(@temp.Id)">加入</a>
                               }
                               else
                               {
                                       @:已经加入
                               }
                               </div>
                </div>
                        }
                    }
                    else
                    { 
                       <div class="gfhd">
                    <div class="title">暂无活动</div>
                    <div class="hdlogo"></div>
                    <div class="sm"></div>
                    <div class="list">
                        <dl>
                            <dt></dt>
                            <dd></dd>
                            <dt></dt>
                            <dd></dd>
                            <dt></dt>
                            <dd></dd>
                        </dl>
                    </div>
                           </div>
                    }
                }
               
            <!--活动列表结束-->

            <div class="fl_right">
                <h1>猜你喜欢</h1>
                <div class="list">
                    <ul>
                        <li><a href="#"><img src="/Themes/Shared/DefaultStyle/images/h-01.jpg" width="179" height="168" /></a><span class="b1"><a href="#">处女座相亲会</a></span><span class="b2">2015年02月14日</span></li>
                    </ul>
                </div>
            </div>

            <div class="bot-con">
                <div class="page">
                    @Html.AjaxPagingButton(Model, "contentItemsContainer")
                @*<a style="background:none repeat scroll 0 0 #F05783;border:1px solid #F05783;color:#FFFFFF">1</a><a href="#">2</a><a href="#">3</a><a href="#">4</a><a href="#">5</a><a class="" href="#">&nbsp;&nbsp;下一页</a>*@
                </div>
            </div>


        </div>

        <!--列表结束-->
        <!--翻页开始-->
        <!--翻页结束-->
    </div>
</div>

<script>
function join(id) {
            $.ajax({
                type: "GET",
                url: "/Channel/Activities.aspx",
                data: { id: id },
                dataType: "json",
                success: function (data) {
                    if (data = 1)
                    {
                        window.location.href = location.href;
                    }
                }
            });
        }

</script>